import { getLocale } from '@umijs/max';
// 传入卡类型代码 返回文字 en-US zh-CN
export const useDetermineCardType = (type?: string, Isflag?: string, num?: string) => {

    const locale = getLocale()

    console.log(locale)

    let str = ""
    let flag = false // 判断是否是传入的卡类型
    let number: string = ""
    if (type == "guestcard" || num == "1") {
        // str = "客人卡"
        str = locale === 'en-US' ? 'Guest Card' : '客人卡'
        number = '1'
        if (Isflag == "guestcard" ) {
            flag = true
        }
    }
    if (type == "losscard") {
        // str = "挂失卡"
        str = locale === 'en-US' ? 'Report Lost card' : '挂失卡'
        number = ''
        if (Isflag == "losscard") {
            flag = true
        }
    }
    if (type == "personnelcard" || num == "10") {
        // str = "员工卡"
        str = locale === 'en-US' ? 'Employee card' : '员工卡'
        number = '10'
        if (Isflag == "personnelcard") {
            flag = true
        }
    }
    if (type == "setcard") {
        // str = "设置卡"
        str = locale === 'en-US' ? 'Setup card' : '设置卡'
        number = ""
        if (Isflag == "setcard") {
            flag = true
        }
    }
    if (type == "mastercard" || num == "2") {
        // str = "总卡"
        str = locale === 'en-US' ? 'Total card' : '总卡'
        number = "2"
        if (Isflag == "mastercard") {
            flag = true
        }
    }
    if (type == "alwaysopencard" || num == "8") {
        // str = "常开卡"
        str = locale === 'en-US' ? 'Always-on card' : '常开卡'
        number = "8"
        if (Isflag == "alwaysopencard") {
            flag = true
        }
    }
    if (type == "setvipcard" || num == "18") {
        number = "18"
        // str = "授权卡"
        str = locale === 'en-US' ? 'Authorization card' : '授权卡'
        if (Isflag == "setvipcard") {
            flag = true
        }
    }
    if (type == "staffcard" || num == "7") {
        // str = "卫生卡"
        str = locale === 'en-US' ? 'Hygiene card' : '卫生卡'
        number = "7"
        if (Isflag == "staffcard") {
            flag = true
        }
    }
    if (type == "emergencycard" || num == "6") {
        // str = "应急卡"
        str = locale === 'en-US' ? 'Emergency card' : '应急卡'
        number = "6"
        if (Isflag == "emergencycard") {
            flag = true
        }
    }
    if (type == "floorcard" || num == "4") {
        // str = "层控卡"

        str = locale === 'en-US' ? 'Layer control card' : '层控卡'
        number = "4"
        if (Isflag == "floorcard") {
            flag = true
        }
    }
    if (type == "buildingcard" || num == "3") {
        // str = "楼栋卡"
        str = locale === 'en-US' ? 'Building card' : '楼栋卡'
        number = "3"
        if (Isflag == "buildingcard") {
            flag = true
        }
    }

    return [str, flag, number]
};
//       
export const IsManage = (type: string) => {
    let flag = false
    if (type == "personnelcard") {
        flag = true
    }
    if (type == "mastercard") {
        flag = true
    }
    if (type == "buildingcard") {
        flag = true
    }
    if (type == "floorcard") {
        flag = true
    }
    if (type == "emergencycard") {
        flag = true
    }
    if (type == "staffcard") {
        flag = true
    } 
    if (type == "setvipcard") {
        flag = true
    }
    if (type == "alwaysopencard") {
        flag = true
    }
    return flag
}


